package com.softcits.hw;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.softcits.hw.ioc.Person;

@Configuration
public class LifecycleApp {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = 
                new AnnotationConfigApplicationContext(LifecycleApp.class);
       
        
        Object obj = ctx.getBean("p");
        
        System.out.println(obj);
        ctx.close();

    }
    
    @Bean(name="p", initMethod="init", destroyMethod="destroyed")
    public Person getPerson() {
        return new Person();
    }

}
